
import 'package:flutter/material.dart';

import 'package:flutter_study/test/drawer_app.dart';

class SnackBarApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Material(
      child:Scaffold(
        body: SnackBarButtonPage(),
      )
    );
  }
}

class SnackBarButtonPage extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return Scaffold(

      body: Center(
        child: RaisedButton(onPressed: (){
          final snackBar = SnackBar(
            content: Text('已添加到购物这中？'),
            action: SnackBarAction(label: '取消', onPressed: (){

            }),
          ) ;
          //Navigator.pushNamed(context, '/DrawerToScreenApp');
          Navigator.of(context).push(MaterialPageRoute(builder: (context){
            return DrawerToScreenApp(itemName: "来自Snackbars",);
          }));
          Scaffold.of(context).showSnackBar(snackBar);
        },child: Text('点击我！'),),
      ),
    );
  }

}
